#region License Information

// ///////////////////////////////////////////////////////////////////////////////////////////////////
// // Settings.cs - Part of HCSS
// //
// // HCSS is a capture screen application
// //
// // This source is subject to the Microsoft Public License (Ms-PL) Permissive License.
// // Please see the License.txt file for more information.
// // All other rights reserved.
// //
// // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// // PARTICULAR PURPOSE.
// //
// // (c) Copyright 2008-2010 Alessandro Cavalieri (cavalieri.alessandro@gmail.com)
// //
// ///////////////////////////////////////////////////////////////////////////////////////////////////

#endregion

using System;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;

namespace HSC
{
    // Decorate the settings class with a SettingsProvider attribute
    // This tells ApplicationSettingsBase to use a non-default provider (e.g. not the 
    // LocalFileSettingsProvider, which targets the .config file)
    [SettingsProvider(typeof (RegistrySettingsProvider))]
    public class Settings : ApplicationSettingsBase
    {
        private static readonly Settings defaultInstance = ((Settings) (Synchronized(new Settings())));

        public static Settings Default
        {
            get { return defaultInstance; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("c:\\temp")]
        [Description("The temporary folder, this folder must be writable for all")]
        public string Path
        {
            get { return ((string) (this["Path"])); }
            set { this["Path"] = value; }
        }

        [UserScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("0")]
        [Description("The last file number")]
        public int LastFileNo
        {
            get { return ((int) (this["LastFileNo"])); }
            set { this["LastFileNo"] = value; }
        }

        [UserScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("0")]
        [Description("The last sent file number")]
        public int LastSentFileNo
        {
            get { return ((int) (this["LastSentFileNo"])); }
            set { this["LastSentFileNo"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("ftp://ftp.drivehq.com")]
        [Description("The ftp provider")]
        public string FTPHostName
        {
            get { return ((string) (this["FTPHostName"])); }
            set { this["FTPHostName"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The ftp account user name")]
        public string FTPUserName
        {
            get { return ((string) (this["FTPUserName"])); }
            set { this["FTPUserName"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The ftp account password")]
        public string FTPPassword
        {
            get { return ((string) (this["FTPPassword"])); }
            set { this["FTPPassword"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("True")]
        [Description("If true Enable the screenshot upload to ftp drive")]
        public bool EnableFTP
        {
            get { return ((bool) (this["EnableFTP"])); }
            set { this["EnableFTP"] = value; }
        }

        [UserScopedSetting]
        [DebuggerNonUserCode]
        [Description("The date of the last log file sent")]
        public DateTime LastSentLogDate
        {
            get { return ((DateTime) (this["LastSentLogDate"])); }
            set { this["LastSentLogDate"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("00:01:00")]
        [Description("The elapsed time from screenshots")]
        public TimeSpan Duration
        {
            get { return ((TimeSpan) (this["Duration"])); }
            set { this["Duration"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The email address where the logs and screenshots will be sent")]
        public string To
        {
            get { return ((string) (this["To"])); }
            set { this["To"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The email address where the usage time logs will be sent as CC")]
        public string CcTo
        {
            get { return ((string)(this["CcTo"])); }
            set { this["CcTo"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The email address where the usage time logs will be sent as second CC")]
        public string CcTo1
        {
            get { return ((string)(this["CcTo1"])); }
            set { this["CcTo1"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The email address where the usage time report will be sent")]
        public string UserTo
        {
            get { return ((string)(this["UserTo"])); }
            set { this["UserTo"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The email account user name, usually it is the smtp authentication user name")]
        public string UserName
        {
            get { return ((string) (this["UserName"])); }
            set { this["UserName"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The email account password, usually it is the smtp authentication password")]
        public string Password
        {
            get { return ((string) (this["Password"])); }
            set { this["Password"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [Description("The email smtp account")]
        public string Smtp
        {
            get { return ((string) (this["Smtp"])); }
            set { this["Smtp"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("00:30:00")]
        [Description("The elapsed time from screenshots email")]
        public TimeSpan MailSendDelay
        {
            get { return ((TimeSpan) (this["MailSendDelay"])); }
            set { this["MailSendDelay"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("False")]
        [Description("If true the screenshots will be sent by email")]
        public bool EnableEmail
        {
            get { return ((bool) (this["EnableEmail"])); }
            set { this["EnableEmail"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("False")]
        public bool NotifyIconVisible
        {
            get { return ((bool) (this["NotifyIconVisible"])); }
            set { this["NotifyIconVisible"] = value; }
        }

        [UserScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("True")]
        [Description("This is set to true for the first run")]
        public bool FirstRun
        {
            get { return ((bool) (this["FirstRun"])); }
            set { this["FirstRun"] = value; }
        }

        [UserScopedSetting]
        [DebuggerNonUserCode]
        [Description("The name of the ftp folder for the daily screenshots (set by the program)")]
        public DateTime FTPDailyDir
        {
            get { return ((DateTime) (this["FTPDailyDir"])); }
            set { this["FTPDailyDir"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("/")]
        [Description("The ftp base dir, the complete ftp folder name is: (FTPBaseDir)/(UserName)/(FTPDailyDir)")]
        public string FTPBaseDir
        {
            get { return ((string) (this["FTPBaseDir"])); }
            set { this["FTPBaseDir"] = value; }
        }

        [UserScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("0")]
        [Description("The total usage mins counter (set by the program)")]
        public int TotalUsageMins
        {
            get { return ((int)(this["TotalUsageMins"])); }
            set { this["TotalUsageMins"] = value; }
        }

        [ApplicationScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("120")]
        [Description("The permitted total usage mins by day, if overflow a warning will be sent to the UserTo email")]
        public int PermittedUsageMins
        {
            get { return ((int)(this["PermittedUsageMins"])); }
            set { this["PermittedUsageMins"] = value; }
        }

    }
}